package com.efesco.payroll.groupItem;

import com.bstek.dorado.view.AbstractViewModel;
import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.*;
import com.bstek.dorado.data.db.DBStatement;


/**
 * itemOrderViewModel
 */
public class itemOrderViewModel extends AbstractViewModel {

public void setOrder(ParameterSet parameters)
throws Exception {
Dataset groupItemDataset = getDataset("groupItemDataset");
DBStatement statement = new DBStatement();

try {
  groupItemDataset.moveFirst();
  RecordIterator ri = groupItemDataset.recordIterator();
  while (ri.hasNext()){
    Record record = ri.nextRecord();
    String groupItemId=record.getString("WA_GROUP_ITEM_ID");
    String displayOrder=record.getString("DISPLAY_ORDER");
    statement.setSql(
    " update s_wa_group_item set DISPLAY_ORDER = "  + displayOrder +
    " where WA_GROUP_ITEM_ID = "+groupItemId);
    statement.execute();
  }

}
finally {
  statement.close();
}
    }

}
